import moment from 'moment';



export function dateFormatYYYYMMDD(value) {
  if (!value) return ''
  value = value.toString()
  if (value && value.indexOf('1970-01-01') >= 0) {
    return ''
  }
  var format = 'YYYY-MM-DD'
  
  return moment(value).format(format)
}


export function dateFormatYYYYMMDDHHmmss(value,stict=false) {
  if (!value) return ''
  value = value.toString()
  if (value && value.indexOf('1970-01') >= 0) {
    return ''
  }
  var format = 'YYYY-MM-DD HH:mm:ss'
  return moment(value).format(format)
}


export function isIOS() {
  var userAgent = navigator.userAgent;
  var _isiOS = userAgent.includes('iPhone') || userAgent.includes('iPad');
  return _isiOS;
}


export function dateFormatMMDD(value, dateformatstr = 'MM-DD') {
  if (!value) return '';
  value = value.toString();
  if (value && value.indexOf('1970-01-01') >= 0) {
    return '';
  }
  
  return moment(value).format(dateformatstr);
}
